﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace AGrandVenture
{
    public static class TextZoomManager
    {
        public static Queue<TextZoom> TextZooms = new Queue<TextZoom>();
        

        public static void AddTextZoom(string message, Color colour, Vector2 location)
        {
            TextZooms.Enqueue(new TextZoom(message, colour, location));
        }

        public static void Update()
        {
            int dequeueCounter = 0;
            foreach (TextZoom zoom in TextZooms)
            {
                zoom.Update();
                if (zoom.IsCompleted)
                    dequeueCounter++;
            }
            for (int d = 0; d < dequeueCounter; d++)
                TextZooms.Dequeue();
        }

        public static void Draw(SpriteBatch spriteBatch)
        {
            foreach (TextZoom zoom in TextZooms)
            {
                spriteBatch.DrawString(Game1.fontPericles8, zoom.Text, zoom.location, zoom.DrawColour, 0.0f, new Vector2(Game1.fontPericles8.MeasureString(zoom.Text).Y / 2), zoom.Scale, SpriteEffects.None, 0.0f);
            }
        }
    }
}
